<template>
	<view>
		<web-view :src="url"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: "",
				info: null
			}
		},
		onLoad(ops) {
			//#ifdef  MP-WEIXIN
			this.info = decodeURIComponent(ops.q);
			// #endif

			//#ifdef  MP-ALIPAY
			this.info = app.globalData.qrCode
			// #endif

			if (!uni.getStorageSync('userKey')) {
				uni.navigateTo({
					url: "../../login/index"
				})
			}
		},
		onShow() {
			this.initUrl();
		},
		methods: {
			initUrl() {
				if (this.info) {
					let pams = this.info.split('id=')[1];
					let pamArr = pams.split('&number=');
					let key = uni.getStorageSync('userKey');
					let url = "https://zaihuayi.top/index.html#/orderIndex/";
					if (pamArr.length == 1) {
						this.url = url + pamArr[0] + '?key=' + key + '&v=2022724';
					} else {
						this.url = url + pamArr[0] + '?number=' + pamArr[1] + '&key=' + key + '&v=2022724';
					}
					console.log(this.url)
				}
			}
		}
	}
</script>

<style>

</style>
